﻿/*
This file is part of Ingo Karstein's SharePoint 2010 Workflow Demo project

**Do not remove this comment**

Please see the project homepage at CodePlex:
  http://spworkflowdemo.codeplex.com/

Please see my blog:
  http://ikarstein.wordpress.com

Licence: GPLv2
    SharePoint 2010 Workflow Demo
    Copyright (C) 2011  Ingo Karstein, ikarstein@hotmail.com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;

namespace îk.SharePoint2010.Workflow.Workflow_1
{
    public sealed partial class Workflow_1 : SequentialWorkflowActivity
    {
        public Workflow_1()
        {
            InitializeComponent();
        }

        public Guid workflowId = default(System.Guid);
        public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();

        private void createTask1Invoke(object sender, EventArgs e)
        {
            task1Properties = new SPWorkflowTaskProperties();
            task1Guid = Guid.NewGuid();
            task1ContentTypeId = "0x01080100FFbc98c2529347a5886b8d2576b954ef";
        }

        public static DependencyProperty task1ContentTypeIdProperty = DependencyProperty.Register("task1ContentTypeId", typeof(System.String), typeof(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Misc")]
        public String task1ContentTypeId
        {
            get
            {
                return ( (string)( base.GetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1ContentTypeIdProperty) ) );
            }
            set
            {
                base.SetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1ContentTypeIdProperty, value);
            }
        }

        public static DependencyProperty task1GuidProperty = DependencyProperty.Register("task1Guid", typeof(System.Guid), typeof(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Misc")]
        public Guid task1Guid
        {
            get
            {
                return ( (System.Guid)( base.GetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1GuidProperty) ) );
            }
            set
            {
                base.SetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1GuidProperty, value);
            }
        }

        public static DependencyProperty task1PropertiesProperty = DependencyProperty.Register("task1Properties", typeof(Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties), typeof(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Misc")]
        public SPWorkflowTaskProperties task1Properties
        {
            get
            {
                return ( (Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties)( base.GetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1PropertiesProperty) ) );
            }
            set
            {
                base.SetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1PropertiesProperty, value);
            }
        }

        public static DependencyProperty task1Changed1_AfterPropertiesProperty = DependencyProperty.Register("task1Changed1_AfterProperties", typeof(Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties), typeof(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Misc")]
        public SPWorkflowTaskProperties task1Changed1_AfterProperties
        {
            get
            {
                return ( (Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties)( base.GetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1Changed1_AfterPropertiesProperty) ) );
            }
            set
            {
                base.SetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1Changed1_AfterPropertiesProperty, value);
            }
        }

        public static DependencyProperty task1Changed1_BeforePropertiesProperty = DependencyProperty.Register("task1Changed1_BeforeProperties", typeof(Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties), typeof(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Misc")]
        public SPWorkflowTaskProperties task1Changed1_BeforeProperties
        {
            get
            {
                return ( (Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties)( base.GetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1Changed1_BeforePropertiesProperty) ) );
            }
            set
            {
                base.SetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1Changed1_BeforePropertiesProperty, value);
            }
        }

        private bool isFinished = false;

        private void task1Changed1Invoke(object sender, ExternalDataEventArgs e)
        {
            isFinished = task1Changed1_AfterProperties.PercentComplete == 1F;
        }

        private void while1Invoke(object sender, ConditionalEventArgs e)
        {
            e.Result = !isFinished;
        }

        public static DependencyProperty task1OutcomeProperty = DependencyProperty.Register("task1Outcome", typeof(System.String), typeof(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Misc")]
        public String task1Outcome
        {
            get
            {
                return ( (string)( base.GetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1OutcomeProperty) ) );
            }
            set
            {
                base.SetValue(îk.SharePoint2010.Workflow.Workflow_1.Workflow_1.task1OutcomeProperty, value);
            }
        }


    }
}
